package org.edu.service.impl;

import java.sql.SQLException;

import org.edu.bean.TmCompinfo;
import org.edu.common.BaseDao;
import org.edu.service.TmCompinfoService;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.springframework.orm.hibernate3.HibernateCallback;
import org.springframework.stereotype.Service;

/**
 * 
 * @author lzh
 *
 * 2012-4-18
 */
@Service
public class TmCompinfoServiceImpl extends BaseDao<TmCompinfo> implements
		TmCompinfoService {

	public TmCompinfo findByTaxplayer(final String taxplayer) {
		return (TmCompinfo)hibernateTemplate.execute(new HibernateCallback() {
			public Object doInHibernate(Session ses) throws HibernateException,
					SQLException {
				return ses.createQuery("FROM TmCompinfo o WHERE o.taxplayer=?")
				.setParameter(0, taxplayer)
				.uniqueResult();
			}
		});
	}
}
